package com.pa;

import com.pa.pojo.Difference;
import com.pa.utils.DiffCommit;
import com.pa.utils.RepositoryRelative;
import org.eclipse.jgit.lib.Repository;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.List;


/**
 * @author Administrator
 */
public class Test {

    //    public static void main(String[] args) throws Exception {
//        String gitRepoPath = "D:\\IDEA\\project\\diffcommit\\.git";
//        FileInputStream fileInputStream = new FileInputStream("D:\\IDEA\\project\\diffcommit\\.git\\refs\\heads\\master");
//        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));
//        String newCommit = bufferedReader.readLine();
//        Difference difference = DiffCommit.diffFile(gitRepoPath, newCommit);
//        System.err.println(difference);
//    }
    //删了类注释，再添加 一点
    //不然效果不明显

    /**
     * 克隆文件
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        String gitFilePath = "D:\\GitProject\\crumb\\.git";
        String commitId = "5e6d4f5c81677fe9e362837ffd4a02394303db3c";
        //String subDir = url.substring(url.lastIndexOf("/"));
        //String filePath = "D:\\GitProject"+subDir;
        //File localFile = new File(filePath);
        //Repository gitClone = RepositoryRelative.getGitClone(localFile, url + ".git");
        //System.out.println(gitClone);
        Difference difference = DiffCommit.diffFile(gitFilePath, commitId);
        System.out.println(difference);
    }
}
